class Solution {
public:
    int findMin(vector<int>& nums) {
        int i = 0;
        int j = nums.size() - 1;
        if (nums[i] < nums[j])
            return nums[i];
        else {
            int taget = nums[j];
            while (i <= j) {
                int mid = (i + j) / 2;
                if (nums[mid] <= taget)
                    j = mid - 1;
                else
                    i = mid + 1;
            }
            return nums[i];
        }
    }
};